package org.jcut.controller;

import org.jcut.bean.Admin;
import org.jcut.data.Data;
import org.jcut.service.AdminService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

@RestController
@RequestMapping("/admin")
public class AdminController {
	@Autowired
	private Data data;
	@Autowired
	private AdminService service;
	/**
	 * @author 王征
	 * @param username 用户名
	 * @param 密码
	 * */
	@RequestMapping("/login")
	public Object login(Admin admin) {
		long i=service.login(admin);
		data.setMyData(Integer.parseInt(String.valueOf(i)), i>0?"登陆成功":"用户名或密码错误", i);
		return data;
	}
}
